![]()
![]()
![]()
Notificiation ============= The central element for controlling a MUI application is the notification mechanism. To understand how it works, its important to know that most objects feature lots of attributes that define their current state. Notification makes it possible to react on changes of these attributes. Attributes are changed either directly by the programmer (with a call to SetAttrs()) or by the user manipulation some gadgets. If he e.g. drags around the knob of a proportional gadget, the MUIA_Prop_First attribute will continously be updated and reflect the current position. With notification, you could directly use this attribute change to set the MUIA_List_TopPixel attribute of a list object, building up a full featured listview: DoMethod(sbar, MUIM_Notify, MUIA_Prop_First, MUIV_EveryTime, list, 3, MUIM_Set, MUIA_List_TopPixel, MUIV_TriggerValue); To make it clear: Every time, the scrollbar object changes its `MUIA_Prop_First' value, the list object shall change its `MUIA_List_TopPixel' attribute accordingly. The value 3 in the above function call identifies the number of the following parameters. Since you can call any method with any parameters here and MUI needs to save it somewhere, it's important to set it correctly. From now on the list and the scrollbar are connected to each other. As soon as the proportional gadget is moved, the position of the list changes accordingly; the programmer doesn't have to care about. Notification is mostly used together with either the `MUIM_Application_ReturnID' or with the `MUIM_CallHook' method. If you e.g. have a specific hook that should be called whenever the user presses a button, you could use the following notify method: DoMethod(button, MUIM_Notify, MUIA_Button_Pressed, FALSE, button, 2, MUIM_CallHook, &ButtonHook); /* Whenever the button's pressed attribute is set to FALSE (i.e. the user has released the button), the button object itself will call ButtonHook. */ Futher information can be found in the autodocs of notify class.